using System.Collections;
using System.Collections.Generic;
using Unity.Netcode;
using UnityEngine;

namespace SinceUnity.LobbyNetwork
{
    public static  class UnityExtend
    {
        public static GameObject NETSpawn(this GameObject who)
        {
            who.GetComponent<NetworkObject>()?.Spawn();
            return who;
        }
        public static Component NETSpawn(this Component who)
        {
            who.GetComponent<NetworkObject>()?.Spawn();
            return who;
        }


        public static GameObject NETDespawn(this GameObject who)
        {
            who.GetComponent<NetworkObject>()?.Despawn();
            return who;
        }
        public static Component NETDespawn(this Component who)
        {
            who.GetComponent<NetworkObject>()?.Despawn();
            return who;
        }

        public static ulong? NETGetClientID(this GameObject who)
        {
            return who.GetComponent<NetworkObject>()?.OwnerClientId;
        }

    }
}
